package org.kotboot.enums;

import org.kotboot.kit.K;

/**
 * Created by jisong.sun on 2017/9/20.
 */

public enum ECommodityState implements CodeEnum<ECommodityState> {
    FORAPPROVE(1,"待审核"),
    APPROVING(10,"审核中"),
    PASSED(20,"审核通过"),
    DENIY(30,"审核拒绝");

    private int code;
    private String title;

    ECommodityState(int code,String title){
        this.code = code;
        this.title = title;
    }

    public static ECommodityState of(String title){
        if(K.isEmpty(title)) return null;
        for(ECommodityState state:ECommodityState.values()){
            if(state.title.equals(title)){
                return state;
            }
        }
        return null;
    }

    @Override
    public int code() {
        return code;
    }

    @Override
    public String toString() {
        return this.title;
    }
}
